<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
	<script src="index.js?a=1"></script>
</head>
<body>

</body>
<script>
	const p = new Promise((resolve,reject)=>{
		// resolve(100);
		reject(200);
	})
	// p.then(value=>{
	// 	console.log("成功",value);
	// },(reason)=>{
	// 	console.log("失败",reason);
	// })
	
	// p.then(value=>{},reason=>{
	// 	console.log("失败",reason);
	// }).catch(reason=>{
	// 	console.log("catch",reason);
	// })
	
	// p.catch(reason=>{
	// 	console.log("catch",reason);
	// })
	
	// 相当于
	// p.then(undefined,reason=>{
	// 	console.log("catch",reason);
	// })
	
	const p1 = p.catch(reason=>{
		console.log(reason);
		// return 1;
		return new Promise(resolve=>resolve(200))
	})
	
	const p2 = p.then(undefined,reason=>{
		console.log("catch",reason);
		// return 2;
		return new Promise(resolve=>resolve(400))
	})
	console.log(p1,p2);
</script>
</html>